package org.easy.eao.spring.hibernate;

import java.util.Iterator;
import java.util.List;

import org.easy.eao.annotations.Named;
import org.easy.eao.annotations.Query;
import org.easy.eao.annotations.Query.FirstResult;
import org.easy.eao.annotations.Query.MaxResults;

public interface QueryGenericEao<T> {

	@Query(query = "from Exam e where e.student = ?")
	List<T> generic_list(String student);
	
	@Query(query = "from Exam e where e.student = ?")
	Iterator<T> generic_iterator(String student);
	
	@Query(query = "from Exam e where e.student = ? and e.subject = ?")
	T generic_unique(String student, String subject);

	@Query(query = "from Exam e where e.student = ? order by e.grade")
	List<T> generic_limit(@FirstResult()int first, String student, @MaxResults()int max);

	@Query(query = "from Exam e where e.subject = :subject")
	List<T> generic_named(@Named("subject")String subject);

}
